package com.eshop.modules.user.rest;

import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import io.swagger.annotations.ApiOperation;
import com.eshop.logging.aop.log.Log;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.data.domain.Pageable;
import com.eshop.modules.user.service.dto.UserBillQueryCriteria;
import com.eshop.modules.user.service.UserBillService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;

@Api(tags = { "商城:用户账单管理" })
@RestController
@RequestMapping({ "api" })
public class UserBillController
{
    private final UserBillService userBillService;
    
    public UserBillController(final UserBillService userBillService) {
        this.userBillService = userBillService;
    }
    
    @Log("查询")
    @ApiOperation("查询")
    @GetMapping({ "/yxUserBill" })
    @PreAuthorize("hasAnyRole('admin','YXUSERBILL_ALL','YXUSERBILL_SELECT')")
    public ResponseEntity getYxUserBills(final UserBillQueryCriteria criteria, final Pageable pageable) {
        return new ResponseEntity(this.userBillService.queryAll(criteria, pageable), HttpStatus.OK);
    }
}
